package com.czk.gulimall.ware.config;


import com.zaxxer.hikari.HikariDataSource;
//import io.seata.rm.datasource.DataSourceProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;

import javax.sql.DataSource;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/5/21 16:08
 */
@Configuration
public class MySeataConfig {
    @Autowired
    private HikariDataSource dataSource; // 没有指定数据源默认是Hikari

    @Autowired
    private DataSourceProperties dataSourceProperties;
/*    @Bean
    public DataSource dataSource(DataSourceProperties dataSourceProperties) {
        HikariDataSource hikariDataSource = dataSourceProperties.initializeDataSourceBuilder().type(HikariDataSource.class).build();
        if (StringUtils.hasText(dataSourceProperties.getName())) {
            // 设置数据源名称
            hikariDataSource.setPoolName(dataSourceProperties.getName());
        }
        // 包装
        return new DataSourceProxy(hikariDataSource);
    }*/


}
